@echo off

echo Create Disc Content
echo -------------------
echo.

if (%1) == () goto SHOWHELP
if (%2) == () goto SHOWHELP

echo Create directories...
IF NOT EXIST "%2\Files\Repository" mkdir "%2\Files\Repository" > nul
IF NOT EXIST "%2\Files\Diplomarbeit" mkdir "%2\Files\Diplomarbeit" > nul
IF NOT EXIST "%2\Files\Diplomarbeit\Quellen" mkdir "%2\Files\Diplomarbeit\Quellen" > nul

echo Copy repository (exclude subversion-directories)...
robocopy %1 %2\Files\Repository\ /XD ".svn" /E > nul

echo Copy diploma thesis and biblography sources...
robocopy "%1\trunk\docs\Diplomarbeit (schriftliche Ausarbeitung)" "%2\Files\Diplomarbeit" Diplomarbeit.docx > nul
robocopy "%1\trunk\docs\Diplomarbeit (schriftliche Ausarbeitung)" "%2\Files\Diplomarbeit" Diplomarbeit.pdf > nul
robocopy "%2\Files\Repository\trunk\docs\Diplomarbeit (schriftliche Ausarbeitung)\Anlagen CD" "%2\Files\Diplomarbeit\Quellen" /E > nul

echo Copy general autorun stuff...
robocopy "%1\trunk\main\CreateDiscContent" "%2\Files" "Readme.txt" "autorun.inf" "wiimote.ico" "shellexe.exe" > nul

echo Generate iso-image...
%1\trunk\main\CreateDiscContent\cdrtools-latest\mkisofs.exe -V GestureLib -quiet -rock -joliet -joliet-long -max-iso9660-filenames -disable-deep-relocation -output "%2\GestureLib.iso" "%2\Files"

echo.
echo Process finished!
echo.
echo Press any key to open output directory in explorer
pause > nul
"%2\Files\shellexe.exe" "%2"

goto END

:SHOWHELP
echo Syntax:
echo           CreateDiscContent.cmd [Repository-Directory] [Output-Directory]
echo           (Important: No backslash at the end of the directory path)
goto END

:END